/*
 * @Description: 
 * @Version: 2.0
 * @Autor: ycw
 * @Date: 2022-02-16 12:08:33
 * @LastEditors: ycw
 * @LastEditTime: 2022-02-16 12:10:38
 */
import https from '@/utils/https'


// 查询定时任务调度列表
export const listJob = (query) => {
  return https({
    url: '/schedule/job/list',
    method: 'get',
    params: query
  })
}

// 查询定时任务调度详细
export const getJob = (jobId) => {
  return https({
    url: '/schedule/job/' + jobId,
    method: 'get'
  })
}

// 新增定时任务调度
export const addJob = (data) => {
  return https({
    url: '/schedule/job',
    method: 'post',
    data: data
  })
}

// 修改定时任务调度
export const updateJob = (data) => {
  return https({
    url: '/schedule/job',
    method: 'put',
    data: data
  })
}

// 删除定时任务调度
export const delJob = (jobId) => {
  return https({
    url: '/schedule/job/' + jobId,
    method: 'delete'
  })
}

// 任务状态修改
export const changeJobStatus = (jobId, status) => {
  const data = {
    jobId,
    status
  }
  return https({
    url: '/schedule/job/changeStatus',
    method: 'put',
    data: data
  })
}


// 定时任务立即执行一次
export const runJob = (jobId, jobGroup) => {
  const data = {
    jobId,
    jobGroup
  }
  return https({
    url: '/schedule/job/run',
    method: 'put',
    data: data
  })
}